package zeebe.gateway.Parallel;

import io.vertx.core.json.JsonObject;
import io.zeebe.client.ZeebeClient;
import io.zeebe.client.api.response.ActivatedJob;
import io.zeebe.client.api.worker.JobClient;
import io.zeebe.client.api.worker.JobHandler;

public class AJobWorkerHandler implements JobHandler {
    ZeebeClient zeebeClient;

    public AJobWorkerHandler(ZeebeClient client) {
        this.zeebeClient = client;
    }

    @Override
    public void handle(JobClient client, ActivatedJob job) throws Exception {
        System.out.println("开始执行AJobWorker");
        System.out.println("执行AService：增加参数A=1");

        JsonObject input=new JsonObject()
                .put("A",1);

        client.newCompleteCommand(job.getKey())
                .variables(input.encode())
                .send()
                .join();
    }
}
